import { StringUtils } from "@/utils/StringUtils"
import { UniStore } from './UniStorege'
const STORE_KEY = {
  SETTINGS: "__wss",
  STATIONS: "__ws_station",
  DEFAULT_STATIONS: "__ws_0xd_station"
}
export class SystemConfig {
  static {

  }

  static setSetting(settings) {
    UniStore.setObject(STORE_KEY.SETTINGS, settings)
  }

  static getSetting() {
    const _str = UniStore.getObject(STORE_KEY.SETTINGS)
    return _str
  }

  static setWorkStation(list = []) {
    UniStore.setObject(STORE_KEY.STATIONS, list)
  }
  static getWorkStation() {
    const _str = UniStore.getObject(STORE_KEY.STATIONS,[])
    return _str
  }

  static clear() {
    UniStore.removeObject(STORE_KEY.STATIONS)
    UniStore.removeObject(STORE_KEY.SETTINGS)
    UniStore.removeObject(STORE_KEY.DEFAULT_STATIONS)
  }

  static hasSetting() {
    const boSetting = Object.entries(STORE_KEY).every(([key, store_key]) => {
      return !StringUtils.isEmptyOrNull(UniStore.getObject(store_key))
    })

    return boSetting
  }

  static setDefaultStationList(list) {
    UniStore.setObject(STORE_KEY.DEFAULT_STATIONS,list)
  }

  static getDefaultStationList() {
    const _str = UniStore.getObject(STORE_KEY.DEFAULT_STATIONS)
    return _str
  }
}
